package com.cx.utils.demo;

import java.util.TreeSet;
import java.util.Random;

/**
 * @program: pms
 * @author: cx
 * @description:
 * @create: 2025-04-11 15:17
 **/
public class Test2 {
    public static void main(String[] args) {

        TreeSet<Integer> arr = new TreeSet<>();

        while (arr.size() < 10) {
            Random random = new Random();
            int start = 1;  // 修改：将start从0改为1
            int end = 80;
            int randomNumber = random.nextInt(end - start + 1) + start;  // 修改：确保随机数从1开始
            arr.add(randomNumber);
        }
        System.out.println(arr);

        // 添加逻辑检查是否包含1和80
//        boolean containsOne = arr.contains(1);
//        boolean containsEighty = arr.contains(80);
//        System.out.println("Contains 1: " + containsOne);
//        System.out.println("Contains 80: " + containsEighty);
    }
}